From 3f945b103c430aa733f17d72194635d213247584 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 19 Jun 2007 15:03:55 +0100 Subject: [PATCH] Further fixes for 32on64 bit kexec. * switch to a suitable stack before jumping to compatibility mode. * return the correct range for KEXEC_RANGE_MA_XEN. Signed-off-by: Ian Campbell --- xen/arch/x86/x86_64/compat_kexec.S | 12 ++++++++++++ xen/common/kexec.c | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/xen/arch/x86/x86_64/compat_kexec.S b/xen/arch/x86/x86_64/compat_kexec.S index 6edda35eef..54b51437f8 100644 --- a/xen/arch/x86/x86_64/compat_kexec.S +++ b/xen/arch/x86/x86_64/compat_kexec.S @@ -73,6 +73,10 @@ ENTRY(compat_machine_kexec) RELOCATE_SYM(idle_pg_table,%rax) movq %rax, %cr3 + /* Switch to identity mapped compatibility stack. */ + RELOCATE_SYM(compat_stack,%rax) + movq %rax, %rsp + /* Save xen_phys_start for 32 bit code. */ movq xen_phys_start(%rip), %rbx @@ -84,6 +88,14 @@ compatibility_mode_far: .long SYM_PHYS(compatibility_mode) .long __HYPERVISOR_CS32 + /* + * We use 5 words of stack for the arguments passed to the kernel. The + * kernel only uses 1 word before switching to its own stack. Allocate + * 16 words to give "plenty" of room. + */ + .fill 16,4,0 +compat_stack: + .code32 #undef RELOCATE_SYM diff --git a/xen/common/kexec.c b/xen/common/kexec.c index 577492fec0..2437799d63 100644 --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -169,7 +169,11 @@ static int kexec_get(reserve)(xen_kexec_range_t *range) static int kexec_get(xen)(xen_kexec_range_t *range) { +#ifdef CONFIG_X86_64 + range->start = xenheap_phys_start; +#else range->start = virt_to_maddr(_start); +#endif range->size = (unsigned long)xenheap_phys_end - (unsigned long)range->start; return 0; } -- 2.30.2